﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Lianxi04();
        }
        public static void Lianxi01()
        {
            Random ran = new Random();

            for (int i = 0; i < 20; i++)
            {
                double d = ran.NextDouble() * 5;
                Console.WriteLine(d.ToString("f2"));
            }
        }
        public static void Lianxi02()
        {
            Random ran = new Random();
            for (int i = 0; i < 20; i++)
            {
                double b = 4 + ran.NextDouble() * (7 - 4);
                Console.WriteLine(b.ToString("f2"));

            }
        }
        public static void Lianxi03()
        {
            int[] arr = new int[10];
            Random a = new Random();
            for (int i = 0; i < arr.Length;)
            {
                int b = a.Next(0, 11);
                if (Array.IndexOf(arr,b)==-1)
                {
                    arr[i] = b;
                    i++;
                }
            }
            foreach (var item in arr)
            {
                Console.Write(item+" ");
            }
        }
        public static void Lianxi04() 
        {

            Console.Write("请输入您的邮箱：");
            string str = Console.ReadLine();

            if (Regex.IsMatch(str, @"^(\w)+(\.?)(\w)*@(\w)+(\.(com|org|net|edu|mil|tv|biz|info))$"))
            {
                Console.WriteLine("输入正确");
            }
            else
            {
                Console.WriteLine("输入错误");
            }
        }
        public static void Lianxi05() 
        {
            Console.WriteLine("请输入你的电话号码");
            string str = Console.ReadLine();
            if (Regex.IsMatch(str, @"^(\+86)?((13\d{1})|(14(5|7))|(15([0-3]{1}|[5-9]{1}))|(17(6|7|8))|(18\d{1}))(\d{8})$"))
            {
                Console.WriteLine("输入正确");
            }
            else
            {
                Console.WriteLine("输入错误");
            }
        }
    }
}
